package behavior.chain2;

import behavior.chain2.impl.DebugLogger;
import behavior.chain2.impl.ErrorLogger;
import behavior.chain2.impl.InfoLogger;

public class ChainTest {

	private static Logger getChainOfLoggers() {

		AbstractLogger errorLogger = new ErrorLogger(AbstractLogger.ERROR);
		AbstractLogger debugLogger = new DebugLogger(AbstractLogger.DEBUG);
		AbstractLogger infoLogger = new InfoLogger(AbstractLogger.INFO);

		errorLogger.setNextLogger(debugLogger);
		debugLogger.setNextLogger(infoLogger);

		return errorLogger;
	}

	public static void main(String[] args) {
		Logger logger = getChainOfLoggers();

		logger.write(AbstractLogger.INFO, "This is an info lvevl information.");

		logger.write(AbstractLogger.DEBUG, "This is an debug level information.");

		logger.write(AbstractLogger.ERROR, "This is an error level information.");
	}

}
